<?php
    class Controller {
    	
    	public function loadModel($name)
    	{
    		require(BASE_DIR .'models/'. strtolower($name) .'.php');
    
    		$model = new $name;
    		return $model;
    	}
    	
    	public function loadView($name)
    	{
    		$view = new View($name);
    		return $view;
    	}
    	
    	public function loadPlugin($name)
    	{
    		require(BASE_DIR .'plugins/'. strtolower($name) .'.php');
    	}
    	
    	public function loadHelper($name)
    	{
    		require(BASE_DIR .'helpers/'. strtolower($name) .'.php');
    		$helper = new $name;
    		return $helper;
    	}
    	
    	public function redirect($loc)
    	{
    		global $config;
    		header('Location: '. $config['base_url'] . $loc);
    	}
        
    }